<template>
	<view>
		<view class="page">
			<comp-common v-bind="{data:data}" @getUserInfo="getUserInfo" @myLogin="myLogin" @getPhoneNumber="getPhoneNumber" @hideGetCoupon="hideGetCoupon" @closeCouponBox="closeCouponBox" @navigatorClick="navigatorClick"></comp-common>
			<comp-header v-bind="{data:data}" @relevanceError="relevanceError" @relevanceSuccess="relevanceSuccess"></comp-header>
			<view class="body">
        <view class="bottom-bar flex-row" v-if="data.is_area==1&&data.offline==0">
            <view class="is_area">所选地区暂时无货</view>
        </view>
        <form @submit="orderSubmit" reportSubmit="true" v-else>
            <view class="bottom-bar flex-row">
                <view class="flex-y-center flex-grow-1" style="padding: 0 24upx">
                    <view class="flex-grow-1" style="color:#ff4544 ">
                            总计：￥{{data.new_total_price}}
                        </view>
                </view>
                <button class="flex-y-center flex-grow-0 flex-x-center submit-btn" formType="submit">提交</button>
            </view>
        </form>
        <view :class="[data.show_card?'no-scroll':'', data.show_shop||data.show_coupon_picker||data.show_card?'hidden':'']" style="padding-bottom: 129upx">
            <view class="flex-row flex-y-center" style="background-color:#fff;padding:0 24upx;border-bottom:1upx #eee solid;border-top:1upx #eee solid;height:90upx;" v-if="data.send_type==0">
                <view class="flex-grow-1 flex-x-center" style="height:100%;">
                    <view @tap="getOffline" :class="['flex-y-center', data.offline==0?'active':'']" :data-city_id="data.address.city_id" data-index="0" style="height:100%;">快递配送
                        </view>
                </view>
                <view class="flex-grow-1 flex-x-center" style="height:100%;">
                    <view @tap="getOffline" :class="['flex-y-center', data.offline==1?'active':'']" data-index="1" style="height:100%;">到店自提
                        </view>
                </view>
            </view>
            <navigator class="flex-row address-picker" url="/pages/address-picker/address-picker" v-if="data.offline==0">
                <view class="flex-grow-1" v-if="data.address">
                    <view class="flex-row" style="margin-bottom: 20upx">
                        <view class="flex-grow-1">收货人：{{data.address.name}}</view>
                        <view class="flex-grow-0">{{data.address.mobile}}</view>
                    </view>
                    <view>收货地址：{{data.address.province}}{{data.address.city}}{{data.address.district}}{{data.address.detail}}</view>
                </view>
                <view class="flex-grow-1" v-else>
                    <view>请选择收货地址</view>
                </view>
                <view class="flex-grow-0 flex-y-center">
                    <image :src="data.__wxapp_img.dapp.jiantou_r.url" style="width: 12upx; height: 22upx;margin-left: 24upx"></image>
                </view>
            </navigator>
            <block v-if="data.offline==1">
                <view class="flex-row address-picker">
                    <view class="flex-grow-1">
                        <view class="flex-row" style="margin-bottom: 20upx">
                            <view class="flex-y-center flex-grow-0">联系人：</view>
                            <view class="flex-grow-1">
                                <input @input="KeyName" placeholder="可以手动填写" :value="data.name"></input>
                            </view>
                        </view>
                        <view class="flex-row">
                            <view class="flex-y-center flex-grow-0">联系电话：</view>
                            <view class="flex-grow-1">
                                <input @input="KeyMobile" placeholder="可以手动填写" :value="data.mobile"></input>
                            </view>
                        </view>
                    </view>
                </view>
                <view :@tap="data.shop_list.length>1?'showShop':''" class="flex-row address-picker">
                    <view class="flex-grow-1">
                        <view class="flex-row" style="margin-bottom: 20upx">
                            <view class="flex-grow-1">门店名称：{{data.shop.name}}</view>
                        </view>
                        <view class="flex-row" style="margin-bottom: 20upx">
                            <view class="flex-grow-1">门店电话：{{data.shop.mobile}}</view>
                        </view>
                        <view>自提门店：{{data.shop.address}}</view>
                    </view>
                    <view class="flex-grow-0 flex-y-center" v-if="data.shop_list.length>1">
                        <image :src="data.__wxapp_img.dapp.jiantou_r.url" style="width: 12upx;height: 22upx;margin-left: 12upx"></image>
                    </view>
                </view>
            </block>
            <view class="address-picker" style="padding:0 24upx;" v-if="data.form&&data.form.is_form==1&&data.form.list.length>0">
                <view class="form-title">{{data.form.name?data.form.name:'表单信息'}}</view>
                <view class="form-list">
                    <view class="form-one flex-row" v-for="(item,index) in data.form.list" :key="item.id">
                        <view :class="['flex-grow-0 list-name', item.type=='text'?'flex-y-center':'', item.required==1?'required':'']">{{item.name}}</view>
                        <view class="flex-grow-1 flex-y-center" v-if="item.type=='text'">
                            <input @confirm="formInput" @input="formInput" @blur="formInput" :data-index="index" :placeholder="item.tip" type="text" :value="item.default"></input>
                        </view>
                        <view class="flex-grow-1" v-if="item.type=='textarea'">
                            <textarea autoHeight="true" @confirm="formInput" @input="formInput" @blur="formInput" :data-index="index" :placeholder="item.tip" style="width:auto;max-height:400upx;z-index:-1" :value="item.default"></textarea>
                        </view>
                        <block v-if="item.type=='time'">
                            <view class="flex-grow-1" style="justify-content:flex-end;text-align:right;">
                                <picker @change="formInput" :data-index="index" end="23:59" mode="time" start="00:00" :value="item.default?item.default:'00:00'">
                                    <view>{{item.default?item.default:'00:00'}}</view>
                                </picker>
                            </view>
                            <view class="flex-grow-0">
                                <image class="right-jiantou" :src="data.__wxapp_img.dapp.jiantou_r.url"></image>
                            </view>
                        </block>
                        <block v-if="item.type=='date'">
                            <view class="flex-grow-1" style="justify-content:flex-end;text-align:right;">
                                <picker @change="formInput" :data-index="index" mode="date" :value="item.default?item.default:time">
                                    <view>{{item.default?item.default:time}}</view>
                                </picker>
                            </view>
                            <view class="flex-grow-0">
                                <image class="right-jiantou" :src="data.__wxapp_img.dapp.jiantou_r.url"></image>
                            </view>
                        </block>
                        <view class="flex-grow-1 flex-row" style="flex-wrap:wrap" v-if="item.type=='radio'">
                            <view @tap="selectForm" :class="['default', v.is_selected==1?'d-active':'']" :data-index="index" :data-k="k" v-for="(v,k) in item.default_list" :key="k">{{v.name}}</view>
                        </view>
                        <view class="flex-grow-1 flex-row" style="flex-wrap:wrap" v-if="item.type=='checkbox'">
                            <view @tap="selectForm" :class="['default', v.is_selected==1?'d-active':'']" :data-index="index" :data-k="k" style="border-radius:0" v-for="(v,k) in item.default_list" :key="k">{{v.name}}</view>
                        </view>
                    </view>
                </view>
            </view>
            <view @tap="showCouponPicker" class="flex-row flex-y-center" style="background: #fff;padding: 0 24upx;height: 90upx;border-bottom: 1upx solid #e3e3e3;" :style="data.integral.forehead_integral>0?'':'margin-bottom: 20upx;'" v-if="data.is_coupon==1">
                <view class="flex-grow-1">优惠券</view>
                <view class="flex-grow-0">
                    <view style="color: #888" v-if="!data.coupon_list||data.coupon_list.length==0">目前无可用优惠券</view>
                    <block v-else>
                        <view style="color: #ff4544" v-if="data.picker_coupon">-{{data.picker_coupon.sub_price}}元</view>
                        <view style="color: #ff4544" v-else>有{{data.coupon_list.length}}张优惠券可以使用</view>
                    </block>
                </view>
                <view class="flex-grow-0">
                    <image :src="data.__wxapp_img.dapp.jiantou_r.url" style="width: 12upx;height: 22upx;margin-left: 12upx"></image>
                </view>
            </view>
            <view class="flex-row flex-y-center" style="background: #fff;padding: 0 24upx;height: 90upx;border-bottom: 1upx solid #e3e3e3;" v-if="data.integral&&data.integral.forehead_integral>0">
                <view class="flex-grow-1 flex-y-center">
                    <view class="flex-y-center">使用{{data.integral.forehead_integral}}积分抵扣</view>
                    <view class="flex-y-center" style="color:#ff4544">{{data.integral.forehead}}</view>
                    <view class="flex-y-center">元</view>
                    <view @tap="integration" class="flex-y-center">
                        <image :src="data.__wxapp_img.dapp.ntegration.url" style="width: 36upx;height: 36upx;margin-left: 12upx"></image>
                    </view>
                </view>
                <view class="flex-grow-0 flex-y-center integral-switch" :data-index="data.integral_radio">
                    <switch checked @change="integralSwitchChange" class="flex-y-center" style="height:44upx"></switch>
                </view>
            </view>
            <view @tap="showPayment" class="flex-row flex-y-center" style="background: #fff;padding: 0 24upx;height: 90upx;border-bottom: 1upx solid #e3e3e3;margin-bottom: 20upx;">
                <view class="flex-grow-1">支付方式</view>
                <view class="flex-grow-0" v-if="data.payment==0">在线支付</view>
                <view class="flex-grow-0" v-if="data.payment==2">货到付款</view>
                <view class="flex-grow-0" v-if="data.payment==3">账户余额支付</view>
                <view class="flex-grow-0">
                    <image :src="data.__wxapp_img.dapp.jiantou_r.url" style="width: 12upx;height: 22upx;margin-left: 12upx"></image>
                </view>
            </view>
            <view class="cart-list">
                <view class="flex-col " v-for="(item,index) in data.goods_list" :key="item.id">
                    <view class="cart-item flex-row" :style="item.give<=0?'border-bottom:1upx solid #e3e3e3':''">
                        <view class="flex-grow-0">
                            <image class="goods-pic" mode="aspectFill" :src="item.goods_pic"></image>
                        </view>
                        <view class="flex-grow-1 flex-col">
                            <view class="flex-grow-1">
                                <view class="goods-name">{{item.goods_name}}</view>
                                <view class="attr-list">
                                    <view class="attr-item" v-for="(attr,i) in item.attr_list" :key="i">
                                        {{attr.attr_group_name}}:{{attr.attr_name}}
                                    </view>
                                </view>
                            </view>
                            <view class="flex-grow-0 flex-row">
                                <view class="flex-grow-1 num">×{{item.num}}</view>
                                <view class="flex-grow-0 price">￥{{item.price}}</view>
                            </view>
                        </view>
                    </view>
                    <view class="goods-intrgral flex-row" v-if="item.give>0">
                        <view class="flex-y-center"> 订单完成返回</view>
                        <view class="flex-y-center" style="color:#ff4544">{{item.give}}</view>
                        <view class="flex-y-center">积分</view>
                    </view>
                </view>
            </view>
            <view class="flex-row" style="background: #fff;padding: 32upx 24upx;margin-bottom:20upx;" v-if="data.level&&data.is_discount==1">
                <view class="flex-grow-1">会员折扣价</view>
                <view class="flex-grow-0">
                    <view style="color:#ff4544">￥{{data.level_price}}</view>
                </view>
            </view>
            <view class="flex-row" style="background: #fff;padding: 32upx 24upx">
                <view class="flex-grow-1">运费：</view>
                <view class="flex-grow-0">
                    <block v-if="data.offline==0">
                        <view style="color:#ff4544" v-if="data.address">￥{{data.express_price}}</view>
                        <view style="color:#888" v-else>请先选择收货地址</view>
                    </block>
                    <view style="color:#ff4544" v-else-if="data.offline==1">￥0</view>
                </view>
            </view>
            <view class="colonel flex-row flex-y-center">
                <view class="message-title flex-grow-0 flex-y-center">买家留言</view>
                <view class="message flex-grow-1 flex-y-center">
                    <input @input="bindkeyinput" class="flex-y-center" placeholder="你有什么想对商家说的都可以填写在这哦~" placeholderClass="message-plaseholder" style="width:100%;" type="text" :value="data.content"></input>
                </view>
            </view>
        </view>
        <view class="coupon-picker" v-if="data.show_coupon_picker">
            <scroll-view class="coupon-list" scrollY="true" style="height: 100%">
                <view style="color: #888;font-size: 9pt;margin-bottom: 20upx;line-height: 1.35">
                    注：优惠券只能抵消商品金额，不能抵消运费，商品金额最多优惠到0.01元
                </view>
                <view @tap="pickCoupon" class="flex-y-center flex-x-center" data-index="-1" style="height: 80upx;margin-bottom: 24upx;color: #888;border: 1upx solid #e3e3e3;border-radius: 10upx">不使用优惠券
                </view>
                <view @tap="pickCoupon" :class="['coupon-item', 'coupon-status-'+item.status, picker_coupon&&item.user_coupon_id==picker_coupon.user_coupon_id?'active':'']" :data-index="index" v-for="(item,index) in data.coupon_list" :key="item.id">
                    <image class="coupon-bg" :src="'/static/images/img-coupon-bg-'+item.status==0?0:1+'.png'"></image>
                    <image class="coupon-status-icon" :src="'/static/images/img-coupon-status-icon-'+item.status+'.png'" v-if="item.status!=0"></image>
                    <view class="flex-row" style="height: 100%;overflow: hidden">
                        <view class="flex-grow-0 flex-col flex-y-center flex-x-center coupon-left">
                            <view class="flex-row flex-y-bottom">
                                <view style="font-size: 9pt">￥</view>
                                <view :style="{fontSize: (item.sub_price.length>4?'13':'19')+'pt',lineHeight: '.9'}">
                                    {{item.sub_price}}
                                </view>
                            </view>
                            <view style="font-size: 8pt;margin-top: 10upx">{{item.min_price_desc}}</view>
                        </view>
                        <view class="flex-grow-1 flex-y-center coupon-right">
                            <view style="width: 100%">
                                <view class="flex-row flex-y-center mb-10">
                                    <view class="flex-grow-1" style="font-size: 13pt;font-weight: bold">{{item.event_desc}}
                                    </view>
                                    <view class="flex-grow-0" style="font-size: 9pt"></view>
                                </view>
                                <view style="font-size: 8pt;color: #888">{{item.begin_time}} ~ {{item.end_time}}</view>
                            </view>
                        </view>
                    </view>
                </view>
            </scroll-view>
        </view>
        <view class="coupon-picker" style="background-color:#f7f7f7;" v-if="data.show_shop">
            <scroll-view class="coupon-list" scrollY="true" style="height: 100%;padding:0;">
                <view class="shop-block flex-y-center">当前地址</view>
                <view class="shop-address flex-row flex-y-center">
                    <view class="flex-grow-1">{{data.location}}</view>
                    <view @tap="dingwei" class="flex-grow-0 flex-y-center">
                        <image :src="data.__wxapp_img.shop.dingwei.url" style="width:32upx;height:32upx;margin-right:2upx;"></image>
                        <text style="color:#2495ff">手动定位</text>
                    </view>
                </view>
                <view class="shop-block flex-y-center">门店列表（仅展示里您最近的30家门店）</view>
                <view @tap="pickShop" class="flex-row address-picker" :data-index="index" style="margin:0;" v-for="(item,index) in data.shop_list" :key="item.id">
                    <view class="flex-grow-0 flex-y-center">
                        <image :src="item.id==data.shop.id?'/static/images/icon-shop-checked.png':'/static/images/icon-shop-un.png'" style="width: 40upx;height: 40upx;margin-right: 20upx"></image>
                    </view>
                    <view class="flex-grow-1">
                        <view class="flex-row" style="margin-bottom: 20upx">
                            <view class="flex-grow-1" style="font-weight:bold;" :style="item.id==data.shop.id?'color:#ff4544':''">
                                {{item.name}}
                            </view>
                            <view class="flex-grow-0" v-if="item.distance!=-1">{{item.distance}}</view>
                        </view>
                        <view class="flex-row" style="margin-bottom: 20upx">
                            <view class="flex-grow-1">电话：{{item.mobile}}</view>
                        </view>
                        <view>地址：{{item.address}}</view>
                    </view>
                </view>
            </scroll-view>
        </view>
        <view class="payment" v-if="data.show_payment">
            <view class="pay-modal">
                <view class="pay-head flex-x-center flex-y-center">支付方式</view>
                <view @tap="payPicker" class="pay-block flex-row flex-y-center" :data-index="item.payment" v-for="(item,index) in data.pay_type_list" :key="item.id">
                    <view class="flex-grow-0">
                        <image :src="item.icon" style="width:72upx;height:72upx;margin-right:30upx;"></image>
                    </view>
                    <view :class="['flex-grow-1', data.payment==item.payment?'red':'']">{{item.name}}</view>
                    <view class="flex-grow-0" v-if="data.payment==item.payment">
                        <image :src="data.__wxapp_img.dapp.pay_right.url" style="width:34upx;height:24upx;"></image>
                    </view>
                </view>
                <view @tap="payClose" class="pay-footer flex-x-center flex-y-center hidden">关闭</view>
            </view>
        </view>
				<get-card v-bind="{data:data}" @cardDel="cardDel" @cardTo="cardTo"></get-card>
    </view>
			<comp-footer v-bind="{data:data}"></comp-footer>
		</view>
	</view>
</template>

<script>var myVue = {};
	var t = "", e = "", a = require("../../../utils/helper.js");
	import getCard from '../../../components/get-card/get-card.vue'
	export default {
		components:{getCard},
		data() {
			return {
				data: {
        total_price: 0,
        address: null,
        express_price: 0,
        content: "",
        offline: 0,
        express_price_1: 0,
        name: "",
        mobile: "",
        integral_radio: 1,
        new_total_price: 0,
        show_card: !1,
        payment: -1,
        show_payment: !1
    },
			};
		},
		onLoad: function(t) {myVue = this;
        myVue.getApp.page.onLoad(this, t);
        var e = this, o = a.formatData(new Date());
        myVue.getApp.core.removeStorageSync(myVue.getApp.const.INPUT_DATA), e.setData({
            options: t,
            time: o
        });
    },
		onReady: function(t) {
        myVue.getApp.page.onReady(this);
    },
    onShow: function(t) {
        myVue.getApp.page.onShow(this);
        var e = this, a = myVue.getApp.core.getStorageSync(myVue.getApp.const.PICKER_ADDRESS);
        a && (e.setData({
            address: a,
            name: a.name,
            mobile: a.mobile
        }), myVue.getApp.core.removeStorageSync(myVue.getApp.const.PICKER_ADDRESS), e.getInputData()), 
        e.getOrderData(e.data.options);
    },
		onHide: function(t) {
        myVue.getApp.page.onHide(this), this.getInputData();
    },
    onUnload: function(t) {
        myVue.getApp.page.onUnload(this), myVue.getApp.core.removeStorageSync(myVue.getApp.const.INPUT_DATA);
    },
		methods: {
			bindkeyinput: function(t) {
        this.setData({
            content: t.detail.value
        });
    },
    KeyName: function(t) {
        this.setData({
            name: t.detail.value
        });
    },
    KeyMobile: function(t) {
        this.setData({
            mobile: t.detail.value
        });
    },
    getOffline: function(t) {
        var e = this, a = this.data.express_price, o = this.data.express_price_1;
        1 == t.target.dataset.index ? this.setData({
            offline: 1,
            express_price: 0,
            express_price_1: a
        }) : this.setData({
            offline: 0,
            express_price: o
        }), e.getPrice();
    },
    dingwei: function() {
        var a = this;
        myVue.getApp.getauth({
            content: "需要获取您的地理位置授权，请到小程序设置中打开授权",
            author: "scope.userLocation",
            success: function(o) {
                o && (o.authSetting["scope.userLocation"] ? myVue.getApp.core.chooseLocation({
                    success: function(o) {
                        t = o.longitude, e = o.latitude, a.setData({
                            location: o.address
                        });
                    }
                }) : myVue.getApp.core.showToast({
                    title: "您取消了授权",
                    image: "/static/images/icon-warning.png"
                }));
            }
        });
    },
    orderSubmit: function(t) {
        var e = this, a = e.data.offline, o = {};
        if (0 == a) {
            if (!e.data.address || !e.data.address.id) return void myVue.getApp.core.showToast({
                title: "请选择收货地址",
                image: "/static/images/icon-warning.png"
            });
            o.address_id = e.data.address.id;
        } else {
            if (o.address_name = e.data.name, o.address_mobile = e.data.mobile, !e.data.shop.id) return void myVue.getApp.core.showModal({
                title: "警告",
                content: "请选择门店",
                showCancel: !1
            });
            if (o.shop_id = e.data.shop.id, !o.address_name || void 0 == o.address_name) return void e.showToast({
                title: "请填写收货人",
                image: "/static/images/icon-warning.png"
            });
            if (!o.address_mobile || void 0 == o.address_mobile) return void e.showToast({
                title: "请填写联系方式",
                image: "/static/images/icon-warning.png"
            });
        }
        if (o.offline = a, -1 == e.data.payment) return e.setData({
            show_payment: !0
        }), !1;
        e.data.cart_id_list && (o.cart_id_list = JSON.stringify(e.data.cart_id_list)), e.data.goods_info && (o.goods_info = JSON.stringify(e.data.goods_info)), 
        e.data.picker_coupon && (o.user_coupon_id = e.data.picker_coupon.user_coupon_id), 
        e.data.content && (o.content = e.data.content), 1 == e.data.integral_radio ? o.use_integral = 1 : o.use_integral = 2, 
        o.payment = e.data.payment, o.formId = t.detail.formId, e.order_submit(o, "ms");
    },
		getOrderData: function(a) {
        var o = this, i = "";
        o.data.address && o.data.address.id && (i = o.data.address.id), a.goods_info && (myVue.getApp.core.showLoading({
            title: "正在加载",
            mask: !0
        }), myVue.getApp.request({
            url: myVue.getApp.api.miaosha.submit_preview,
            data: {
                goods_info: a.goods_info,
                address_id: i,
                longitude: t,
                latitude: e
            },
            success: function(t) {
                if (o.getApp.core.hideLoading(), 0 == t.code) {
                    var e = t.data.shop_list, a = {};
                    1 == e.length && (a = e[0]);
                    var i = o.getApp.core.getStorageSync(o.getApp.const.INPUT_DATA);
                    i || (i = {
                        address: t.data.address,
                        name: t.data.address ? t.data.address.name : "",
                        mobile: t.data.address ? t.data.address.mobile : "",
                        shop: a
                    }, t.data.pay_type_list.length > 0 && (i.payment = t.data.pay_type_list[0].payment, 
                    t.data.pay_type_list.length > 1 && (i.payment = -1))), i.total_price = t.data.total_price, 
                    i.level_price = t.data.level_price, i.is_level = t.data.is_level, i.goods_list = t.data.list, 
                    i.goods_info = t.data.goods_info, i.express_price = parseFloat(t.data.express_price), 
                    i.coupon_list = t.data.coupon_list, i.shop_list = t.data.shop_list, i.send_type = t.data.send_type, 
                    i.level = t.data.level, i.integral = t.data.integral, i.new_total_price = t.data.level_price, 
                    i.is_payment = t.data.is_payment, i.is_coupon = t.data.list[0].coupon, i.is_discount = t.data.list[0].is_discount, 
                    i.is_area = t.data.is_area, i.pay_type_list = t.data.pay_type_list, o.setData(i), 
                    o.getInputData(), 1 == t.data.send_type && o.setData({
                        offline: 0
                    }), 2 == t.data.send_type && o.setData({
                        offline: 1
                    }), o.getPrice();
                }
                1 == t.code && o.getApp.core.showModal({
                    title: "提示",
                    content: t.msg,
                    showCancel: !1,
                    confirmText: "返回",
                    success: function(t) {
                        t.confirm && (1 == getCurrentPages().length ? o.getApp.core.redirectTo({
                            url: "/pages/index/index"
                        }) : o.getApp.core.navigateBack({
                            delta: 1
                        }));
                    }
                });
            }
        }));
    },
    copyText: function(t) {
        var e = t.currentTarget.dataset.text;
        e && myVue.getApp.core.setClipboardData({
            data: e,
            success: function() {
                self.showToast({
                    title: "已复制内容"
                });
            },
            fail: function() {
                self.showToast({
                    title: "复制失败",
                    image: "/static/images/icon-warning.png"
                });
            }
        });
    },
    showCouponPicker: function() {
        var t = this;
        t.getInputData(), t.data.coupon_list && t.data.coupon_list.length > 0 && t.setData({
            show_coupon_picker: !0
        });
    },
    pickCoupon: function(t) {
        var e = this, a = myVue.getApp.core.getStorageSync(myVue.getApp.const.INPUT_DATA);
        myVue.getApp.core.removeStorageSync(myVue.getApp.const.INPUT_DATA);
        var o = t.currentTarget.dataset.index;
        a.show_coupon_picker = !1, a.picker_coupon = "-1" != o && -1 != o && e.data.coupon_list[o], 
        e.setData(a), e.getPrice();
    },
    numSub: function(t, e, a) {
        return 100;
    },
    showShop: function(t) {
        var e = this;
        e.getInputData(), e.dingwei(), e.data.shop_list && e.data.shop_list.length >= 1 && e.setData({
            show_shop: !0
        });
    },
    pickShop: function(t) {
        var e = this, a = t.currentTarget.dataset.index, o = myVue.getApp.core.getStorageSync(myVue.getApp.const.INPUT_DATA);
        myVue.getApp.core.removeStorageSync(myVue.getApp.const.INPUT_DATA), o.show_shop = !1, o.shop = "-1" != a && -1 != a && e.data.shop_list[a], 
        e.setData(o), e.getPrice();
    },
    integralSwitchChange: function(t) {
        var e = this;
        0 != t.detail.value ? e.setData({
            integral_radio: 1
        }) : e.setData({
            integral_radio: 2
        }), e.getPrice();
    },
    integration: function(t) {
        var e = this.data.integral.integration;
        myVue.getApp.core.showModal({
            title: "积分使用规则",
            content: e,
            showCancel: !1,
            confirmText: "我知道了",
            confirmColor: "#ff4544",
            success: function(t) {
                t.confirm;
            }
        });
    },
    getPrice: function() {
        var t = this, e = (t.data.total_price, parseFloat(t.data.level_price)), a = t.data.express_price, o = t.data.picker_coupon, i = t.data.integral, s = t.data.integral_radio, n = (t.data.level, 
        t.data.is_level, t.data.offline);
        o && (e -= o.sub_price), i && 1 == s && (e -= parseFloat(i.forehead)), e <= .01 && (e = .01), 
        0 == n && (console.log(a), e += a, console.log(e)), e = parseFloat(e), t.setData({
            new_total_price: e.toFixed(2)
        });
    },
    cardDel: function() {
        this.setData({
            show_card: !1
        }), myVue.getApp.core.redirectTo({
            url: "/pages/order/order?status=1"
        });
    },
    cardTo: function() {
        this.setData({
            show_card: !1
        }), myVue.getApp.core.redirectTo({
            url: "/pages/card/card"
        });
    },
    formInput: function(t) {
        var e = this, a = t.currentTarget.dataset.index, o = e.data.form, i = o.list;
        i[a].default = t.detail.value, o.list = i, e.setData({
            form: o
        });
    },
    selectForm: function(t) {
        var e = this, a = t.currentTarget.dataset.index, o = t.currentTarget.dataset.k, i = e.data.form, s = i.list;
        if ("radio" == s[a].type) {
            var n = s[a].default_list;
            for (var r in n) r == o ? n[o].is_selected = 1 : n[r].is_selected = 0;
            s[a].default_list = n;
        }
        "checkbox" == s[a].type && (1 == (n = s[a].default_list)[o].is_selected ? n[o].is_selected = 0 : n[o].is_selected = 1, 
        s[a].default_list = n), i.list = s, e.setData({
            form: i
        });
    },
    showPayment: function() {
        this.setData({
            show_payment: !0
        });
    },
    payPicker: function(t) {
        var e = t.currentTarget.dataset.index;
        this.setData({
            payment: e,
            show_payment: !1
        });
    },
    payClose: function() {
        this.setData({
            show_payment: !1
        });
    },
    getInputData: function() {
        var t = this, e = {
            address: t.data.address,
            name: t.data.name,
            mobile: t.data.mobile,
            content: t.data.content,
            payment: t.data.payment,
            shop: t.data.shop
        };
        myVue.getApp.core.setStorageSync(myVue.getApp.const.INPUT_DATA, e);
    },
		},
	}
</script>

<style scoped>

.bottom-bar {
    position: fixed;
    bottom: var(--window-bottom);
    left: 0;
    height: 120upx;
    background: #fff;
    border-top: 1upx solid #e3e3e3;
    width: 100%;
    z-index: 1000;
}

.is_area {
    background: #FEBD14;
    font-size:;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.bottom-bar .submit-btn {
    background-color: #ff4544;
    color: #fff;
    width: 250upx;
    text-align: center;
    margin: 0;
    padding: 0;
    border-radius: 0;
}

.address-picker {
    background: #fff;
    padding: 32upx 24upx;
    margin-bottom: 20upx;
    border-bottom: 1upx solid #e3e3e3;
}

.cart-list {
    margin-bottom: 20upx;
}

.cart-checkbox {
    display: inline-block;
    width: 40upx;
    height: 40upx;
    background-size: 100% 100%;
    background-image: url();
}

.cart-checkbox.active {
    background-image: url();
}

.cart-item {
    background: #fff;
    padding: 32upx 24upx 10upx 24upx;
}

.cart-item .goods-pic {
    width: 156upx;
    height: 156upx;
    margin-right: 20upx;
}

.cart-item .goods-name {
    margin-bottom: 10upx;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cart-item .attr-list,.cart-item .num {
    font-size: 9pt;
    color: #888;
}

.cart-item .attr-list .attr-item {
    display: inline-block;
    margin-right: 36upx;
}

.cart-item .attr-list .attr-item:last-child {
    margin-right: 0;
}

.cart-item .price {
    color: #ff4544;
}

.coupon-picker {
    position: fixed;
    top: var(--window-top);
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1001;
    background: #fff;
    border-top: 1upx solid #e3e3e3;
}

.coupon-list {
    padding: 34upx;
}

.coupon-list .coupon-item {
    height: 152upx;
    width: 682upx;
    position: relative;
    margin-bottom: 24upx;
}

.coupon-list .coupon-item.coupon-status-1 .coupon-right,.coupon-list .coupon-item.coupon-status-2 .coupon-right {
    color: rgba(0,0,0,0.35)!important;
}

.coupon-list .coupon-item .coupon-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
}

.coupon-list .coupon-item .coupon-status-icon {
    width: 140upx;
    height: 98upx;
    position: absolute;
    top: 0;
    right: 8upx;
    z-index: 1;
}

.coupon-list .coupon-item .coupon-left {
    color: #fff;
    width: 202upx;
}

.coupon-list .coupon-item .coupon-right {
    padding: 20upx 10upx;
}

.active {
    border-bottom: 4upx #ff4544 solid;
    color: #ff4544;
}

.shop-block {
    width: 100%;
    height: 70upx;
    padding-left: 24upx;
}

.shop-address {
    width: 100%;
    background-color: #fff;
    padding: 30upx 24upx;
}

.goods-intrgral {
    height: 60upx;
    background-color: #fff7f6;
    width: 100%;
    border-bottom: 1upx solid #e3e3e3;
    color: #919191;
    font-size: 9pt;
    padding: 0 24upx;
}

.integral-switch .wx-switch-input {
    width: 42px;
    height: 22px;
}

.integral-switch .wx-switch-input::before {
    width: 41px;
    height: 20px;
}

.integral-switch .wx-switch-input::after {
    width: 20px;
    height: 20px;
}

.form-title {
    width: 100%;
    height: 72upx;
    line-height: 72upx;
    border-bottom: 1upx #e3e3e3 solid;
    color: #707070;
    padding: 0 24upx;
}

.form-list {
}

.form-one {
    padding: 24upx 0;
    border-bottom: 1upx #e3e3e3 solid;
}

.form-one:last-child {
    margin: 0;
    border: 0;
}

.required::before {
    content: '*';
    color: #ff4544;
}

.form-one .list-name {
    width: 170upx;
    justify-content: flex-end;
    text-align: right;
    margin-right: 20upx;
}

.default {
    height: 56prx;
    padding: 12upx 24upx;
    margin-right: 20upx;
    border-radius: 56upx;
    border: 1upx #ccc solid;
    color: #666;
    margin-bottom: 10upx;
}

.default:last-child {
    margin-right: 0;
}

.d-active {
    background-color: #ff4544;
    color: #fff;
    border: 1upx #ff4544 solid;
}

.right-jiantou {
    width: 12upx;
    height: 22upx;
    margin-left: 12upx;
}

.payment {
    width: 100%;
    height: 100%;
    position: fixed;
    left: 0;
    bottom: var(--window-bottom);
    z-index: 9999;
    background-color: rgba(0,0,0,0.5);
}

.pay-modal {
    width: 100%;
    position: absolute;
    left: 0;
    bottom: 0;
    background-color: #fff;
}

.pay-head {
    height: 80upx;
    width: 100%;
    color: #353535;
    border-bottom: 1upx #e2e2e2 solid;
}

.pay-block {
    width: 100%;
    height: 120upx;
    color: #999;
    padding: 0 30upx;
    border-bottom: 1upx #e2e2e2 solid;
}

.red {
    color: #ff4544;
}

.pay-footer {
    width: 100%;
    height: 88upx;
    background-color: #ff4544;
    color: #fff;
}

.colonel {
    height: 88upx;
    background-color: #ffffff;
    border-top: 1upx solid #e2e2e2;
    padding: 0 24upx;
    font-size: 11pt;
    color: #353535;
}

.message-title {
    width: 170upx;
}

.message-plaseholder {
    font-size: 9pt;
}

.message input {
    font-size: 11pt;
    line-height: 1;
}
</style>
